/*
 * (c) 2019 <tanghaifeng-gz@loongson.cn> <pengren.mcu@qq.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 *
 */

#ifndef __LS2K_COME_CONFIG_H
#define __LS2K_COME_CONFIG_H

#define CONFIG_RECOVER

#include "ls2k1000_common.h"

/* Loongson bootelf bootparam smbios */
#define CONFIG_LOONGSON_BOARD_NAME "LS2K1000-COM-Express"

#undef CPU_CLOCK_RATE
#define CPU_CLOCK_RATE  900000000	/* 定义cpu核心频率为900 MHz */
#undef DDR_CLOCK_RATE
#define DDR_CLOCK_RATE  500000000	/* 定义ddr工作频率为500 MHz */

/* Framebuffer and LCD */
#if defined(CONFIG_VIDEO_LS1X)
#define LS1X_DC0
//#define LS1X_DC0_USE_DEMODE
#define LS1X_DC1
//#define LS1X_DC1_USE_DEMODE
#define LS1X_DC_MAX 2
#endif

#define	CONFIG_EXTRA_ENV_SETTINGS					\
	CONSOLE_STDOUT_SETTINGS \
	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
	"fdt_addr=" __stringify(FDT_LOAD_ADDR) "\0" \
	"rd_start=" __stringify(RAMDISK_START) "\0" \
	"rd_size=" __stringify(RAMDISK_SIZE) "\0" \
	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0"					\
	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"				\
	"splashpos=m,m\0" \
	"video=" "VGA-1:1920x1080-32@60 video=VGA-2:1920x1080-32@60" "\0" \
	"panel0=" "vesa1920x1080@60" "\0" \
	"panel1=" "vesa1920x1080@60" "\0" \
	"root_dev=sda\0" \
	"syspart=1\0" \
	"update=1\0" \
	"menucmd=bootmenu\0" \
	"bootmenu_0=System boot select=updatemenu bootselect 1\0" \
	"bootmenu_1=Update kernel=updatemenu kernel 1\0" \
	"bootmenu_2=Update u-boot=updatemenu uboot 1\0" \
	"bootmenu_3=System install or recover=updatemenu system 1\0" \
	"bootmenu_delay=10\0" \

/*
#define CONFIG_BOOTCOMMAND	"setenv bootargs ${bootargs} root=/dev/${root_dev}${syspart} mtdparts=${mtdparts} video=${video}\; \
scsi scan\;ext4load scsi 0:${syspart} ${loadaddr} /boot/uImage\;bootm ${loadaddr}"*/
#define CONFIG_BOOTCOMMAND	"bootcfg scsi"

#define CONFIG_LS2K_USED_LINUX3_10


/* ls2k ddr配置 */
#define DDR3_DIMM
#define LSMC_2
#define DDR_PARAM_018 0x3030303016100000
#define DDR_FREQ DDR_CLOCK_RATE/1000000

//#define TEMP_EXTREME
//#define NO_AUTO_TRFC

//#define ARB_LEVEL
//#define AUTO_DDR_CONFIG

//#define DDR_16BIT
//#define DDR_RESET_REVERT

#define DDR_PARAM_NUM   110 //内存条定义了LSMC_2 DDR_PARAM_NUM=116

#if (CONFIG_LOONGSON2_DRAM_SIZE == 2)
//2GB
#define DISABLE_DDR_A15
#define DDR_S1 (MC_SDRAM_TYPE_DDR3    /* sdram type: DDR3/DDR2 */ \
		| MC_DIMM_ECC_NO        /* dimm ECC: YES/NO */ \
		| MC_DIMM_BUF_REG_NO    /* dimm buffer register: YES/NO, for RDIMM use YES, all else use NO*/ \
		| MC_DIMM_WIDTH_64      /* memory data width: 64/32 */ \
		| MC_SDRAM_ROW_15       /* sdram row address number: 15~11 */ \
		| MC_SDRAM_COL_10       /* sdram column address number: 12~9 */ \
		| MC_SDRAM_BANK_8       /* sdram bank number: 8/4 */ \
		| MC_ADDR_MIRROR_NO    /* for standard DDR3 UDIMM, use YES, else use NO */ \
		| MC_SDRAM_WIDTH_X16     /* SDRAM device data width: 8/16 */ \
		| MC_USE_CS_0         /* the CS pins the sdram connected on(split by '_', from small to big) */ \
		| MC_MEMSIZE_(4)        /* MC memory size, unit: 512MB */ \
		| USE_MC_0)
#elif (CONFIG_LOONGSON2_DRAM_SIZE == 4)
//4GB
#define DDR_S1 (MC_SDRAM_TYPE_DDR3    /* sdram type: DDR3/DDR2 */ \
		| MC_DIMM_ECC_NO        /* dimm ECC: YES/NO */ \
		| MC_DIMM_BUF_REG_NO    /* dimm buffer register: YES/NO, for RDIMM use YES, all else use NO*/ \
		| MC_DIMM_WIDTH_64      /* memory data width: 64/32 */ \
		| MC_SDRAM_ROW_16       /* sdram row address number: 15~11 */ \
		| MC_SDRAM_COL_10       /* sdram column address number: 12~9 */ \
		| MC_SDRAM_BANK_8       /* sdram bank number: 8/4 */ \
		| MC_ADDR_MIRROR_NO    /* for standard DDR3 UDIMM, use YES, else use NO */ \
		| MC_SDRAM_WIDTH_X16     /* SDRAM device data width: 8/16 */ \
		| MC_USE_CS_0         /* the CS pins the sdram connected on(split by '_', from small to big) */ \
		| MC_MEMSIZE_(8)        /* MC memory size, unit: 512MB */ \
		| USE_MC_0)
#endif

#endif	/* __LS2K_COME_CONFIG_H */
